/*
  Copyright 2006-2008, Romz
  Copyright 2010, Polo
  Licenced under Academic Free License version 3.0
  Review OpenUsbLd README & LICENSE files for further details.
*/

#include "mcemu.h"

/* Module Description */
IRX_ID(MODNAME, 1, 7);

// clang-format off
const u8 xortable[256] = {
    /* Table for the ECC calculation */
    0x00, 0x87, 0x96, 0x11, 0xA5, 0x22, 0x33, 0xB4,
    0xB4, 0x33, 0x22, 0xA5, 0x11, 0x96, 0x87, 0x00,
    0xC3, 0x44, 0x55, 0xD2, 0x66, 0xE1, 0xF0, 0x77,
    0x77, 0xF0, 0xE1, 0x66, 0xD2, 0x55, 0x44, 0xC3,
    0xD2, 0x55, 0x44, 0xC3, 0x77, 0xF0, 0xE1, 0x66,
    0x66, 0xE1, 0xF0, 0x77, 0xC3, 0x44, 0x55, 0xD2,
    0x11, 0x96, 0x87, 0x00, 0xB4, 0x33, 0x22, 0xA5,
    0xA5, 0x22, 0x33, 0xB4, 0x00, 0x87, 0x96, 0x11,
    0xE1, 0x66, 0x77, 0xF0, 0x44, 0xC3, 0xD2, 0x55,
    0x55, 0xD2, 0xC3, 0x44, 0xF0, 0x77, 0x66, 0xE1,
    0x22, 0xA5, 0xB4, 0x33, 0x87, 0x00, 0x11, 0x96,
    0x96, 0x11, 0x00, 0x87, 0x33, 0xB4, 0xA5, 0x22,
    0x33, 0xB4, 0xA5, 0x22, 0x96, 0x11, 0x00, 0x87,
    0x87, 0x00, 0x11, 0x96, 0x22, 0xA5, 0xB4, 0x33,
    0xF0, 0x77, 0x66, 0xE1, 0x55, 0xD2, 0xC3, 0x44,
    0x44, 0xC3, 0xD2, 0x55, 0xE1, 0x66, 0x77, 0xF0,
    0xF0, 0x77, 0x66, 0xE1, 0x55, 0xD2, 0xC3, 0x44,
    0x44, 0xC3, 0xD2, 0x55, 0xE1, 0x66, 0x77, 0xF0,
    0x33, 0xB4, 0xA5, 0x22, 0x96, 0x11, 0x00, 0x87,
    0x87, 0x00, 0x11, 0x96, 0x22, 0xA5, 0xB4, 0x33,
    0x22, 0xA5, 0xB4, 0x33, 0x87, 0x00, 0x11, 0x96,
    0x96, 0x11, 0x00, 0x87, 0x33, 0xB4, 0xA5, 0x22,
    0xE1, 0x66, 0x77, 0xF0, 0x44, 0xC3, 0xD2, 0x55,
    0x55, 0xD2, 0xC3, 0x44, 0xF0, 0x77, 0x66, 0xE1,
    0x11, 0x96, 0x87, 0x00, 0xB4, 0x33, 0x22, 0xA5,
    0xA5, 0x22, 0x33, 0xB4, 0x00, 0x87, 0x96, 0x11,
    0xD2, 0x55, 0x44, 0xC3, 0x77, 0xF0, 0xE1, 0x66,
    0x66, 0xE1, 0xF0, 0x77, 0xC3, 0x44, 0x55, 0xD2,
    0xC3, 0x44, 0x55, 0xD2, 0x66, 0xE1, 0xF0, 0x77,
    0x77, 0xF0, 0xE1, 0x66, 0xD2, 0x55, 0x44, 0xC3,
    0x00, 0x87, 0x96, 0x11, 0xA5, 0x22, 0x33, 0xB4,
    0xB4, 0x33, 0x22, 0xA5, 0x11, 0x96, 0x87, 0x00,
};
// clang-format on

PtrSecrAuthCard pSecrAuthCard[MCEMU_PORTS] = {DummySecrAuthCard, DummySecrAuthCard}; /* Pointer to SecrAuthCard() handler */
McImageSpec vmcSpec[MCEMU_PORTS] = {{0xC0DEFAC0}, {0xC0DEFAC1}};                     /* Virtual Memory Card Informations */
MemoryCard memcards[MCEMU_PORTS] = {{0}, {0}};                                       /* Memory Card descriptors */
void *pFastBuf = NULL;                                                               /* Pointer to Fast I/O buffer */

PtrRegisterLibraryEntires pRegisterLibraryEntires; /* Pointer to RegisterLibraryEntires routine */
Sio2McProc pSio2man25, pSio2man51;                 /* Pointers to SIO2MAN routines */
Sio2McProc2 psio2_mc_transfer_init, psio2_transfer_reset;
void (*pSio2man67)();

u8 mceccbuf[MCEMU_PORTS][0x20]; /* ECC buffers */
u8 mcdatabuf[0x200];            /* Data buffer (Same buffer for both cards) */

SifRpcClientData_t *pClientData; /* Pointer to RPC client data for libmc calls (FastIO support) */
void *pFastRpcBuf;               /* Pointer to buffer for RPC data for libmc calls (FastIO support) */

PtrMcIo pMcRead, pMcWrite; /* Pointers to MCMAN's file I/O functions */
//------------------------------
// end of data definitions
//---------------------------------------------------------------------------
// End of file: mcsiovar.c
//---------------------------------------------------------------------------
